/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Human Booster
 */
public class LicenceSoftware implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    private Integer id;
    private String name;
    private int useDurationLimit;
    private int launchCounterLimit;
    @ManyToOne(optional = false)
    private Software softwareId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "licenceSoftwareId")
    private Collection<LicenceCustomer> licenceCustomerCollection;

    public LicenceSoftware() {
    }

    public LicenceSoftware(Integer id) {
        this.id = id;
    }

    public LicenceSoftware(Integer id, String name, int useDurationLimit, int launchCounterLimit) {
        this.id = id;
        this.name = name;
        this.useDurationLimit = useDurationLimit;
        this.launchCounterLimit = launchCounterLimit;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getUseDurationLimit() {
        return useDurationLimit;
    }

    public void setUseDurationLimit(int useDurationLimit) {
        this.useDurationLimit = useDurationLimit;
    }

    public int getLaunchCounterLimit() {
        return launchCounterLimit;
    }

    public void setLaunchCounterLimit(int launchCounterLimit) {
        this.launchCounterLimit = launchCounterLimit;
    }

    public Software getSoftwareId() {
        return softwareId;
    }

    public void setSoftwareId(Software softwareId) {
        this.softwareId = softwareId;
    }

    @XmlTransient
    public Collection<LicenceCustomer> getLicenceCustomerCollection() {
        return licenceCustomerCollection;
    }

    public void setLicenceCustomerCollection(Collection<LicenceCustomer> licenceCustomerCollection) {
        this.licenceCustomerCollection = licenceCustomerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LicenceSoftware)) {
            return false;
        }
        LicenceSoftware other = (LicenceSoftware) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.LicenceSoftware[ id=" + id + " ]";
    }
    
}
